package jdk.thread.lock;

import java.util.concurrent.locks.AbstractQueuedSynchronizer;

public class MyAQS extends AbstractQueuedSynchronizer {


    public static void main(String[] args) throws InterruptedException {
        MyAQS aqs = new MyAQS();

        aqs.acquire(1);
        aqs.release(1);

        aqs.acquireShared(1);
        aqs.releaseShared(1);

    }

    @Override
    protected boolean tryAcquire(int arg) {
        return compareAndSetState(0, 1);
    }


    @Override
    protected boolean tryRelease(int arg) {
        return super.tryRelease(arg);
    }
}
